<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 6 }" :wrapperCol="{ span: 18 }">
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.eventTypeCk">流程事件类型</ZgCheckbox>
        </template>
        <ZgDictionary v-model="obj.eventType" code="eventType"></ZgDictionary>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.callModeCk">调用方式</ZgCheckbox>
        </template>
        <ZgDictionary v-model="obj.callMode" code="callMode"></ZgDictionary>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.isAsyncCk">是否异步</ZgCheckbox>
        </template>
        <ZgSwitch v-model="obj.isAsync"></ZgSwitch>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.busiTypeCk">业务逻辑类型</ZgCheckbox>
        </template>
        <ZgDictionary v-model="obj.busiType" code="busiType"></ZgDictionary>
      </a-form-item>
      <a-form-item>
        <template slot="label">
          <ZgCheckbox v-model="obj.isOpenCk">是否启用</ZgCheckbox>
        </template>
        <ZgCheckbox v-model="obj.isOpen"></ZgCheckbox>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
import { dic } from './dic'
export default {
  props: {
    ids: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data () {
    return {
      dic,
      obj: {
        eventTypeCk: false,
        eventType: '',
        callModeCk: false,
        callMode: '',
        isAsyncCk: false,
        isAsync: false,
        busiTypeCk: false,
        busiType: '',
        isOpenCk: false,
        isOpen: false,
        id: '0'
      }
    }
  },
  methods: {
    save () {
      if (
        this.obj.eventTypeCk === false &&
        this.obj.callModeCk === false &&
        this.obj.isAsyncCk === false &&
        this.obj.busiTypeCk === false &&
        this.obj.isOpenCk === false &&
        true) {
        return this.$result.error('请选择要设置的属性')
      }
      if (this.obj.eventTypeCk === true && this.obj.eventType.length === 0) {
        return this.$result.error('请输入流程事件类型：SUBMIT、RETURN、REVOKE、CANCEL')
      }
      if (this.obj.callModeCk === true && this.obj.callMode.length === 0) {
        return this.$result.error('请输入调用方式：API、REFLECT')
      }
      if (this.obj.busiTypeCk === true && this.obj.busiType.length === 0) {
        return this.$result.error('请输入业务逻辑类型')
      }
      return this.$result.ok(Object.assign({ idList: this.ids }, this.obj))
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
